/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('dashdeviceconsole', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model DeletePromptRequest {
  groupId?: string(name='groupId', example='chat'),
}

model DeletePromptResponseBody = {
  data?: any(name='data', example='{$PromptContent}'),
  errorCode?: string(name='errorCode', example='success'),
  message?: string(name='message', example='successful'),
  requestId?: string(name='requestId', description='Id of the request', example='5090DEE5-E7DB-59A8-B712-28918D3AAA8A'),
  statusCode?: int32(name='statusCode', example='200'),
}

model DeletePromptResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeletePromptResponseBody(name='body'),
}

/**
 * @summary delete prompt
 *
 * @param request DeletePromptRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeletePromptResponse
 */
async function deletePromptWithOptions(request: DeletePromptRequest, headers: map[string]string, runtime: $RuntimeOptions): DeletePromptResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.groupId)) {
    query['groupId'] = request.groupId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeletePrompt',
    version = '2025-04-08',
    protocol = 'HTTPS',
    pathname = `/prompt/delete`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary delete prompt
 *
 * @param request DeletePromptRequest
 * @return DeletePromptResponse
 */
async function deletePrompt(request: DeletePromptRequest): DeletePromptResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return deletePromptWithOptions(request, headers, runtime);
}

model GetPromptRequest {
  groupId?: string(name='groupId', example='chat'),
}

model GetPromptResponseBody = {
  data?: any(name='data', example='{$PromptContent}'),
  errorCode?: string(name='errorCode', example='success'),
  message?: string(name='message', example='successful'),
  requestId?: string(name='requestId', description='Id of the request', example='BDA59622-2114-5F68-A530-3FCACAF0F04F'),
  statusCode?: int32(name='statusCode', example='200'),
}

model GetPromptResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPromptResponseBody(name='body'),
}

/**
 * @summary get prompt
 *
 * @param request GetPromptRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPromptResponse
 */
async function getPromptWithOptions(request: GetPromptRequest, headers: map[string]string, runtime: $RuntimeOptions): GetPromptResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.groupId)) {
    query['groupId'] = request.groupId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetPrompt',
    version = '2025-04-08',
    protocol = 'HTTPS',
    pathname = `/prompt/get`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary get prompt
 *
 * @param request GetPromptRequest
 * @return GetPromptResponse
 */
async function getPrompt(request: GetPromptRequest): GetPromptResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getPromptWithOptions(request, headers, runtime);
}

model PushPromptRequest {
  groupId?: string(name='groupId', example='chat'),
  promptContent?: string(name='promptContent', example='{}'),
}

model PushPromptResponseBody = {
  data?: any(name='data', example='True'),
  errorCode?: string(name='errorCode', example='success'),
  message?: string(name='message', example='successful'),
  requestId?: string(name='requestId', description='Id of the request', example='5090DEE5-E7DB-59A8-B712-28918D3AAA8A'),
  statusCode?: int32(name='statusCode'),
}

model PushPromptResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PushPromptResponseBody(name='body'),
}

/**
 * @summary push prompt
 *
 * @param request PushPromptRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PushPromptResponse
 */
async function pushPromptWithOptions(request: PushPromptRequest, headers: map[string]string, runtime: $RuntimeOptions): PushPromptResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.groupId)) {
    query['groupId'] = request.groupId;
  }

  var body : map[string]any = {};
  if (!$isNull(request.promptContent)) {
    body['promptContent'] = request.promptContent;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'PushPrompt',
    version = '2025-04-08',
    protocol = 'HTTPS',
    pathname = `/prompt/push`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary push prompt
 *
 * @param request PushPromptRequest
 * @return PushPromptResponse
 */
async function pushPrompt(request: PushPromptRequest): PushPromptResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return pushPromptWithOptions(request, headers, runtime);
}

